#include <QtGui/QApplication>

#include "qprojectloader.h"

#include "qdeviceapplication.h"

#include "../../libs/shared/pluginloader.h"
#include "../../libs/running/qrunningmanager.h"

#include <QFont>
#include <QMessageBox>
#include <QTextCodec>
#include <QSettings>

int main(int argc, char *argv[])
{
    QDeviceApplication a(argc, argv);

    if(argc>1)
    {
        QString str=argv[1];
        QStringList l=str.split("=");
        if(l.size()==2)
        {
            if(l.first()=="update")
            {
                if(l.at(1)=="true")
                {
                    QMessageBox::critical(NULL,QObject::tr("Update"),QObject::tr("Update Success!"));
                }
                else
                {
                    QMessageBox::critical(NULL,QObject::tr("Update"),QObject::tr("Update Faulse, use the last project!"));
                }
            }
        }
    }

    QTextCodec *gbk = QTextCodec::codecForName("GBK");
    QTextCodec::setCodecForTr(gbk);
    QTextCodec::setCodecForLocale(gbk);
    QTextCodec::setCodecForCStrings(gbk);

    QFont f=a.font();
    f.setFamily("Arial");
    a.setFont(f);

    PluginLoader::load_plugin(a.applicationDirPath()+"/device_plugins.xml");

    QProjectLoader l;
    l.run();

    return a.exec();
}
